package com.kc.business.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

/**
 * FileName: BizRole
 * Author:   TP
 * Date:     2020-10-30 08:03
 * Description: 角色信息
 */
@Data
@Table(name = "kc_role")
public class BizRole {

    @Id
    private Integer id;

    /** 角色名称 */
    @NotBlank(message = "角色名称不能为空")
    @Size(min = 1, max = 16, message = "角色名称长度应在1～16位之间")
    private String roleName;

    @NotBlank(message = "角色标识不能为空")
    @Size(min = 1, max = 32, message = "角色名称长度应在1～32位之间")
    private String roleKey;

    /** 角色状态 */
    @NotNull(message = "角色状态不能为空")
    private Integer status;

    /** 是否删除 */
    private Integer isDeleted;

    /** 创建人 */
    private String createBy;

    /** 创建时间 */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /** 修改人 */
    private String updateBy;

    /** 修改时间 */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /** 角色可操作菜单，数据库无此字段 */
    @Transient
    private List<Integer> menuIds;
}
